/**
 * ======================================
 * 说明： 商户账号
 * 作者： piaoyizhe
 * 文件： Account.js
 * 日期： 2024/11/4 15:36
 * ======================================
 */


export default class Account extends CommonModels {
  tableFields() {
    return {
      no: {
        label: "学号",
        type: "varchar(20)"
      },
      username: {
        label: "用户名",
        type: "varchar(20)"
      },
      avatar: {
        label: "头像",
        type: "varchar(500)"
      },
      email: {
        label: "邮箱",
        type: "varchar(60)"
      },
      mobile: {
        label: "手机号",
        type: "varchar(11)",
        defaultValue: ""
      },
      password: {
        label: "密码",
        type: "varchar(32)"
      },
      score: {
        label: "积分记录字段",
        type: "int(11)"
      },
      roles: {
        label: "角色",
        type: "varchar(32)",
        defaultValue: "customer"
      },
      isAdmin: {
        label: "是否为管理员, 0不是 1是",
        type: "tinyint(1)"
      },
      type: {
        label: "账号类型",
        type: "int(2)",
        defaultValue: 1
      },
      authentication: {
        label: "账号认证",
        type: "int(2)",
        defaultValue: 0
      },
      status: {
        label: "状态 1启用 0禁用",
        type: "int(32)",
        defaultValue: 1
      },
      desc: {
        label: "简介",
        type: "varchar(500)"
      },
      address: {
        label: "地址",
        type: "varchar(200)"
      },
      industry: {
        label: "行业",
        type: "varchar(200)"
      }
    };
  }

  rules() {
    return {
      mobile: [
        { type: "string", required: true },
        { type: "unique", message: "手机号已存在" }
      ]
    };
  }

  /**
   * 表名
   */
  tableName() {
    return "{{%account}}";
  }
}
